package models;

import java.util.Collection;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import play.db.jpa.Model;

@Entity
public class Carte extends Model {

	public String nom;
	@OneToMany
	public Collection<Pays> pays;
	@OneToMany
	public Collection<Territoire> territoires;

	public Carte(String nom, Collection<Pays> pays) {
		this.nom = nom;
		this.pays = pays;
	}
	
	public static List<Carte> getCartes(){
		return find("order by nom").fetch();
	}
	
	public static Carte getCarte(String nom){
		return find("nom", nom).first();
	}
}
